package edu.kit.aifb.lidasora.ppmModel.transitionCount;


/**
 * This class models a transition count
 * 
 * This class models a simple transition count. For each true prediction, the
 * count is incremented by a ceratin value, for each false prediction it is
 * decremented. By choosing good values for these functions, a weighting between
 * true predictions and false prediction can be achieved. This class is
 * thread-safe.
 * 
 * @author Daniel
 * @see TransitionCount
 */
public class ConcurrentWeightedDecrement extends TransitionCount {

	
	private final int addTrue;
	private final int decFalse;
	
	/**
	 * Creates a new ConcurrentWeightedDecrement
	 * 
	 * Creates a new ConcurrentWeightedDecrement. 
	 * 
	 * @param addTrue the value thtat should be added in case of true prediction
	 * @param decFalse the value that should be subtracted in case of false prediction
	 */
	public ConcurrentWeightedDecrement(int addTrue, int decFalse) {
		this.addTrue = addTrue;
		this.decFalse = decFalse;
	}
	
	/**
	 * {inheritDoc}
	 */
	@Override
	public void truePrediction() {
		count.addAndGet(addTrue);
	}

	/**
	 * {inheritDoc}
	 */
	@Override
	public void falsePrediction() {
		count.addAndGet(-decFalse);

	}

	/**
	 * {inheritDoc}
	 */
	@Override
	public double getTransitionValue() {
		return count.get();
	}

	
}
